/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.elcom.emocbc.cbcgateway.httpclient;

import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author GiangLT
 */
public class LoggingResponseHandler implements ResponseHandler<String> {

    private static final Logger logger = LoggerFactory.getLogger(LoggingResponseHandler.class);

    @Override
    public String handleResponse(HttpResponse hr) throws ClientProtocolException, IOException {
        String reponseContent = EntityUtils.toString(hr.getEntity());
        logger.debug("<<< Response received: {}", reponseContent);
        return reponseContent;
    }
}
